﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Layouts/List.Master" CodeBehind="DistributePlanList.aspx.cs" Inherits="HHMMS.UI.Modules.PlanManager.DistributePlanList" %>

<asp:Content ContentPlaceHolderID="head" ID="idFormTitle" runat="server">
   <title>配送计划管理</title> 
</asp:Content>

<asp:Content ID="idContent" ContentPlaceHolderID="Content" runat="Server">   
    <!-- 搜索框 -->
	<div class="search" style="margin-top:2px;">
        <web:search ID="GridSearch" GridViewId="SmartGridView1" runat="server">            
            <SearchConditionTemplate>                                       
                <table cellpadding="0" cellspacing="0" width="95%">
			        <tr>
                        <th>
                            开始日期：
                        </th>
                        <td>
                            <web:DatePicker ID="dpCreateDtStart" Name="beginTime" runat="server" DateTimeFormat="yyyy-MM-dd"
                                validator="required"></web:DatePicker>
                        </td>
                        <th>
                            结束日期：
                        </th>
                        <td>
                            <web:DatePicker ID="dpCreateDtEnd" Name="endTime" runat="server" DateTimeFormat="yyyy-MM-dd"
                                validator="required"></web:DatePicker>
                        </td> 
                        <th>
                            备注：
                        </th>
                        <td>
                            <asp:TextBox ID="txtRemark" name="Remark" CssClass="txtSelect" runat="server"></asp:TextBox>
                        </td>                                   
                    </tr>
                     <tr>
                        <th>
                            机车号：
                        </th>
                        <td>
                            <asp:TextBox ID="txtLocomotiveNo" name="LocomotiveNo" CssClass="txtSelect" runat="server"></asp:TextBox>
                        </td>
                        <th>
                            修程：
                        </th>
                        <td>
                            <asp:TextBox ID="txtRepairProcess" name="RepairProcess" CssClass="txtSelect" runat="server"></asp:TextBox>
                        </td>
                        <th>
                          
                        </th>
                        <td>
                          
                        </td>
                    </tr>
                </table>
            </SearchConditionTemplate>                      
        </web:search>        
    </div>

    <div class="datalist">
	    <!-- 标题头 -->
	    <h2 style="height:30px;">
				 配送计划列表
	    </h2>
	    <!-- 工具栏 -->
	    <div class="toolbar"  style="height:30px;">
            <asp:LinkButton ID="LinkButton2" runat="server" OnClick="LinkButtonExport_Click">
                <span>
                    <img id="Img2" alt="" runat="server" src="~/Images/icon_excel.gif" style="border: 0px" />导出
                </span>
            </asp:LinkButton>
            <% if (this.isAdmin)
               {    
             %>
            <asp:LinkButton ID="LinkButton1" runat="server"
                OnClientClick="return openEditor(this, 'Insert');" OnClick="SearchGrid">
                <span>
                    <img alt="" runat="server" id="img1" src="~/Images/icon_new.gif" style="border: 0px" />新建
                </span>
            </asp:LinkButton>   
              <% }%>         
	    </div>
	    <div class="datagrid"  style="clear:left;">    
            <!--------------------------- List Area --------------------------->
            <web:SmartGridView ID="SmartGridView1" runat="server" AutoGenerateColumns="False"
                Width="100%" DataKeyNames="Id" DataSourceID="SmartDataSource1" PageSize="10" onrowdatabound="SmartGridView1_RowDataBound">
                <Columns>  
                    <asp:BoundField DataField="Time" HeaderText="填表时间" SortExpression="Time" ItemStyle-HorizontalAlign="left" />
                    <asp:BoundField DataField="LocomotiveNo" HeaderText="机车号" ItemStyle-HorizontalAlign="left" SortExpression="LocomotiveNo" />
                    <asp:BoundField DataField="RepairProcess" HeaderText="修程" ItemStyle-HorizontalAlign="left"  SortExpression="RepairProcess"/>
                    <asp:BoundField DataField="isPS" HeaderText="是否确认配送" ItemStyle-HorizontalAlign="center" SortExpression="isPS"/>
                    <asp:BoundField DataField="psr" HeaderText="配送人" ItemStyle-HorizontalAlign="center" SortExpression="psr"/>
                    <asp:BoundField DataField="psrdt" HeaderText="配送时间" ItemStyle-HorizontalAlign="center" SortExpression="psrdt"/>
                    <asp:BoundField DataField="Mtype" HeaderText="机型" ItemStyle-HorizontalAlign="left" SortExpression="Mtype"/>
                    <asp:BoundField DataField="Remark" HeaderText="备注" ItemStyle-HorizontalAlign="left" SortExpression="Remark" />
                    <asp:TemplateField HeaderText="操作">
                        <ItemStyle HorizontalAlign="Center" />
                        <HeaderStyle Wrap="False" HorizontalAlign="Center" />
                        <ItemTemplate>
                            <table width="46px">
                                <tr>
                                   <td style="border: 0px solid #fff;">
                                        <asp:ImageButton ID="ibtnAdd" runat="server" ToolTip="配送计划明细" _KeyId='<%#Eval("Id")%>'
                                            ImageUrl="~/images/com/dg_view.gif" CausesValidation="False" OnClientClick="return openEditor(this, 'Add');" OnClick="RefreshGrid">
                                        </asp:ImageButton>
                                    </td>
                                    <td style="border: 0px solid #fff;">
                                        <asp:ImageButton ID="ImageButton1" runat="server" ToolTip="克隆修程" CommandName='<%#Eval("Id")%>'
                                            ImageUrl="~/images/com/idt_tle_c.gif" CausesValidation="False"  OnClick="Clone">
                                        </asp:ImageButton>
                                    </td>
                                    <td style="border: 0px solid #fff;">
                                        <asp:ImageButton ID="ibtnEdit" runat="server" ToolTip="修改" _KeyId='<%#Eval("Id")%>'
                                            ImageUrl="~/images/com/dg_edit.gif" CausesValidation="False" OnClientClick="return openEditor(this, 'Edit');" OnClick="RefreshGrid">
                                        </asp:ImageButton>
                                    </td>
                                    <td style="border: 0px solid #fff;">
                                        <asp:ImageButton ID="ibtnDelete" runat="server" ToolTip="删除" ImageUrl="~/images/com/dg_del.gif" _KeyId='<%#Eval("Id")%>'
                                          OnClientClick="return confirm('您确认要删除吗?')" OnClick="DeleteDictionaryItem">
                                        </asp:ImageButton>
                                    </td>
                                </tr>
                            </table>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
                <PagerSettings />
                <EditRowStyle HorizontalAlign="Center" />
            </web:SmartGridView>
    
            <web:SmartSqlDataSource ID="SmartDataSource1" runat="server" SelectCommand="DistributePlan.list" SelectCountCommand="DistributePlan.list.count"
            SelectCommandAutoPageWrap="true" DefaultSortExpression="Time desc">       
                        
            </web:SmartSqlDataSource>
        </div>
	</div>
     <script type="text/javascript">

         function openEditor(_this, action) {
             var url = "DistributePlanEdit.aspx";

             // FormViewMode : Insert/Edit/ReadOnly
             var params = { FormViewMode: action }
             if (action == "Insert") {
                 params.title = "配送计划明细";
             } else if (action == "Edit") {
                 var flag = '<%= isAdmin.ToString().ToLower() %>'
                 if (flag == 'true') {
                     params.title = "编辑配送计划";
                     params.Id = _this.attributes["_KeyId"].value;
                 }
                 else {
                     alert("对不起，您不是管理员，您没有权限！");
                     return false;
                 }
             }
             else if (action == "Add") {

                 url = "DistributePlanDetailList.aspx";
                 params.title = "新增配送计划明细";
                 params.MgId = _this.attributes["_KeyId"].value;

             }

             var returnValue = showCenterModalDialog(buildUrl(url, params), 800, 350);
             if (returnValue == "true") {
                 return true;
             }
             return false;
         }

    </script>
</asp:Content>
